// --------------------------------------------------------------------------------------------------------------------
// <copyright file="TaskResult.cs" company="JDML Consulting Ltd.">
//   Copyright 2011 Photon Project - http://photon.codeplex.com
// </copyright>
// <summary>
//   Defines the TaskResult type.
// </summary>
// --------------------------------------------------------------------------------------------------------------------

namespace Photon.Threading
{
    using System;
    using System.Diagnostics.CodeAnalysis;

    public class TaskResult : ITaskResult
    {
        public TaskResult(Exception error, bool isCanceled, object asyncState)
        {
            Error = error;
            IsCanceled = isCanceled;
            AsyncState = asyncState;
        }

        public Exception Error { get; private set; }

        public bool IsCanceled { get; private set; }

        public object AsyncState { get; private set; }
    }

    [SuppressMessage("Microsoft.StyleCop.CSharp.MaintainabilityRules", "SA1402:FileMayOnlyContainASingleClass",
        Justification = "Reviewed. Suppression is OK here.")]
    public class TaskResult<T> : TaskResult, ITaskResult<T>
    {
        public TaskResult(T result, Exception error, bool isCanceled, object asyncState)
            : base(error, isCanceled, asyncState)
        {
            Result = result;
        }

        public T Result { get; private set; }
    }
}